<!DOCTYPE>
<html>
<meta name="csrf-token" content="{{ csrf_token() }}">
@include('common/head');
<body>
	<!--header-->
	@include('common/navbar')
	<!-- header end -->
	
	<div class="page-container"> 
	  <div class="page-content" id="mainContents"> 
	  	<div class="container-fluid">
		<div class="row-fluid clearfix">
	    	<!-- BEGIN STYLE CUSTOMIZER -->
	        <div class="span12"> 	          		          
	          <h3 class="page-title">   &nbsp  </h3>
	          <ul class="breadcrumb">
	            <li> <i class="icon-home"></i> <a href="index.html">首页</a> <i class="icon-angle-right"></i> </li>
	            <li><a href="javascript:;">用户管理</a></li>		            
	          </ul>		          		          		          
	        </div>
	        <!-- END PAGE TITLE & BREADCRUMB--> 
	    </div>
		<!-- BEGIN PAGE CONTENT-->

		<div class="row-fluid">
			<div class="tabbable tabbable-custom tabbable-full-width">

				<ul class="nav nav-tabs" id="singletabs">
					<li class="active" data-id=""><a data-toggle="tab" href="#tab_1_12">用户管理</a></li>
					<li data-id=""><a data-toggle="tab" href="#tab_1_1">角色管理</a></li>
					<li data-id="{{$firstId}}"><a data-toggle="tab" href="#tab_2_2" >权限分配</a></li>

				</ul>

				<div class="tab-content layui-tab-content">
					<!--用户管理-->
					<div id="tab_1_12" class="tab-pane onlytab active">
						<div class="row-fluid margin-bottom-20">
							<div class="span12">	
								<!-- BEGIN EXAMPLE TABLE PORTLET-->
								<div class="portlet box light-grey">	
									<div class="portlet-body">	
										<div class="clearfix">	
											<div class="btn-group">	
												<button id="sampadd_user" class="btn btn-success">
												新增用户
												</button>	
												<!--<a href="/" id="sample_add_1" class="btn btn-success">
												新增
												</a>-->
											</div>
											<div class="btn-group">	
												<button id="sample_edit_2" class="btn btn-primary">
												编辑
												</button>	
											</div>
											<div class="btn-group">	
												<button id="sample_agin_3" class="btn btn-default j-delete">
												删除
												</button>	
											</div>
											<div class="btn-group">	
												<button  id="sample_reset_4" class="btn btn-danger">
												重置密码
												</button>
											</div>											
										</div>
										<div class="ordertball table-responsive margin-bottom-20">
										    <table class="table table-bordered tablelist" id="dataTableDetail">
							                    <thead class="tbhead">
								                    <tr>	
								                    	<th>
								                    		<label class="frstrate">
												    			<input type="checkbox"class="checkson selectAll-user" />
												    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
												    		</label>
								                    	</th>
								                        <th class="t1">
								                        	<p>序号</p>
								                        	<div class="controls lastrate">
								                        		<input class="input-control putw2" type="hidden" readonly>
															</div>
								                        </th>	
								                        <th class="t1">
								                        	<p class="">用户名称</p>
								                        	<div class="controls searchUser" id="" >
																<input class="input-control putw2" value="" type="text" placeholder="请输入用户名">
															</div>
								                        </th>
								                        <th class="t1">
								                        	<p>所属角色</p>
								                        	<div class="controls" >
																<select class="input-control selwd2 c-custname" id="search_role" name="custName">
																	@foreach($roleAll as $k=>$v)
																		<option value="{{$v->name}}" data-id="{{$v->id}}">{{$v->name}}</option>
																	@endforeach
																</select>
															</div>
								                        </th>
								                        <th class="t1">
								                        	<p>登录账号</p>
								                        	<div class="controls searchUser">
																<input placeholder="请输入登录帐号" class="input-control putw1 c-officer" type="text" name="getOfficer">
															</div>
								                        </th>
								                        <th class="t1">
								                        	<p>创建时间</p>
															<div class="controls time_screen">
																<input placeholder="开始时间" class="input-control putw3 c-begintime" type="text" name="beginTime" id="beginTime">
																-
																<input placeholder="结束时间" class="input-control putw3 c-endtime" type="text" name="endTime" id="endTime">
															</div>
								                        </th>
								                        
								                        <th class="t1">
								                        	<p>最近登录时间</p>
								                        	<div class="controls login_time_screen">
								                        		<input placeholder="最近登录开始时间" class="input-control putw3 c-loginlatytime" type="text" name="loginLatyTime" id="loginLatyTime">
								                        		-
								                        		<input placeholder="最近登录结束时间" class="input-control putw3 c-loginOvertime" type="text" name="loginOverTime" id="loginOverTime">
								                        	</div>
								                        </th>
								                        <th class="t1">
								                        	<p>状态</p>
								                        	<div class="controls ">
																<select class="input-control selwd1 c-salesman" id="type_screen" name="salesman">
																	<option value="1">启用</option>
																	<option value="0">禁止</option>
																</select>
															</div>
								                        </th>								                       
								                    </tr>
							                    </thead>
							                    <tbody class="tbbody screen tbbody-user">
												@foreach($userAll as  $k=>$v)
								                    <tr>
								                    	<td>					                    		
								                    		<label>
												    			<input data-id="{{$v->id}}"  type="checkbox" class="checkson checkbox_child"/>
												    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
												    		</label>
														</td>
								                        <td>{{$k+1}}</td>
								                        <td class="name">{{$v->username}}</td>
								                        <td class="role_name">{{$v->role_name}}</td>
								                        <td>{{$v->username}}</td>
								                        <td>{{$v->created_at}}</td>
								                        <td>{{$v->updated_at}}</td>
															<td class="lasttd update-status">
																<a class="c-put  {{$v->status==1?'orderedt':'orderdel'}}" data-status="{{$v->status}}"  href="javascript:;">{{$v->status==1?'启用':'禁止'}}</a>
															</td>
								                    </tr>
												@endforeach

							                    </tbody>
							               </table>
										</div>
										
						               <div class="row-fluid">
							               	<div class="span6"><div class="dataTables_info" id="sample_editable_1_info">共{{$userAll->total()}}条数据</div></div>
							               	<div class="span6">
												{{$userAll->links()}}
							               	</div>
							            </div>
									</div>	
								</div>	
								<!-- END EXAMPLE TABLE PORTLET-->	
							</div>
						</div>						
					</div>
					<!--角色管理-->
					<div id="tab_1_1" class="tab-pane onlytab">
						<div class="row-fluid margin-bottom-20">
							<div class="span12">	
								<!-- BEGIN EXAMPLE TABLE PORTLET-->
								<div class="portlet box light-grey">	
									<div class="portlet-body">	
										<div class="clearfix">	
											<div class="btn-group">	
												<button id="sample_add_role" class="btn btn-success">
												新增角色
												</button>
												<!-- <a href="/" id="sample_add_1" class="btn btn-success">
												新增
												</a> -->
											</div>
											<div class="btn-group">	
												<button id="role_edit_2" class="btn btn-primary">
												编辑
												</button>	
											</div>
											<div class="btn-group">	
												<button id="role_delete_3" class="btn btn-default">
												删除
												</button>	
											</div>											
										</div>
										<div class="ordertball table-responsive margin-bottom-20">
										    <table class="table table-bordered tablelist" id="dataTableDetail">
							                    <thead class="tbhead">
								                    <tr>	
								                    	<th width="26">
								                    		<label class="frstrate">
												    			<input type="checkbox"class="checkson SelectAllImg" />								
												    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
												    		</label>
								                    	</th>
								                        <th class="t1">
								                        	<p>序号</p>
								                        	<div class="controls lastrate">
								                        		<input class="input-control putw2" type="hidden" readonly>
															</div>
								                        </th>	
								                        
								                        <th class="t1">
								                        	<p>角色名称</p>
								                        	<div class="controls">
																<select class="input-control selwd2 c-custname" id="role_manager_screen" name="custName">
																	@foreach($roleAll as $k=>$v)
																	<option value="{{$v->name}}" data-id="{{$v->id}}">{{$v->name}}</option>
																	@endforeach

																</select>
															</div>
								                        </th>
								                        <th class="t1">
								                        	<p>角色描述</p>
								                        	<div class="controls serch_role_description">
																<input class="input-control putw2" type="text" placeholder="请输入角色描述">
															</div>
								                        </th>
								                        <th class="t1">
								                        	<p>创建时间</p>
								                        	<div class="controls role_time">
								                        		<input placeholder="开始时间" class="input-control putw3 c-begintime" type="text" name="beginTime" id="role_beginTime">
								                        		-
								                        		<input placeholder="结束时间" class="input-control putw3 c-endtime" type="text" name="endTime" id="role_endTime">
								                        	</div>
								                        </th>
								                        <th class="t1">
								                        	<p>状态</p>
								                        	<div class="controls">
																<select class="input-control selwd1 c-salesman" id="role_status_screen" name="salesman">
																	<option value="1">启用</option>
																	<option value="0">禁止</option>
																</select>
															</div>
								                        </th>								                       
								                    </tr>
							                    </thead>
							                    <tbody class="tbbody tbbody-role">
												@foreach($roleAll as $k=>$v)
								                    <tr>
								                    	<td>					                    		
								                    		<label>
												    			<input data-id="{{$v->id}}" type="checkbox" class="checkson checkbox_child"/>
												    			<img src="{{URL::asset('static/images/c_checkbox_off.png')}}"/>
												    		</label>
														</td>
								                        <td>{{$k+1}}</td>
								                        <td>{{$v->name}}</td>
								                        <td>{{$v->description}}</td>
								                        <td>{{$v->created_time}} - {{$v->updated_time}}</td>
														<td class="lasttd update_role_status">
								                        	<a class="c-put {{$v->status==1?'orderedt':'orderdel'}}  j-forbid"  data-status="{{$v->status}}"  href="javascript:;">{{$v->status==1?'启用':'禁止'}}</a>
								                        </td>
													</tr>
												@endforeach

							                    </tbody>
							               </table>
										</div>
										
						               <div class="row-fluid">
							               	<div class="span6"><div class="dataTables_info" id="sample_editable_1_info">共{{$roleAll->total()}}条数据</div></div>
							               	<div class="span6">
												{{$userAll->links()}}
							               	</div>
							            </div>
									</div>	
								</div>	
								<!-- END EXAMPLE TABLE PORTLET-->	
							</div>
						</div>						
					</div>

					<!--end tab-pane-->
					<!-- 权限分配 -->

					<div id="tab_2_2" class="tab-pane onlytab">
						<div class="tabbable tabbable-custom tabs-left">
							<!-- Only required for left/right tabs -->
							<ul class="nav nav-tabs tabs-left" id="j-role">
								@foreach($roleAll as $k=>$v)

								<li class="{{$k==0?'active':''}}" data-id="{{$v->id}}"><a class="lfta"   data-toggle="tab"  href="#tab_son_{{$v->id}}">{{$v->name}}</a></li>

								@endforeach

							</ul>
							<div class="tab-content">
								@foreach($roleAll as $k=>$v)
									<div class="tab-pane  {{$k==0?'active':''}}" id="tab_son_{{$v->id}}" style="min-height: 400px;">

									<div class="Assign_style">
										<div class="Select_Competence">
											<!-- 系统管理1 -->
											<div class="perall">
												<div  class="permission-list">
													<div class="pertit">
														<!-- <input name="user-Character-0" class="ace" type="checkbox" id="id-disable-check"> -->
														<span class="lbl">系统管理</span>
													</div>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">用户信息</dt>
														<dd class="span8">

															@foreach($perList['0'] as $k=>$v)

															<label class="chbox">

																	<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																	<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}

															</label>
															@endforeach


														</dd>
														<div class="clearfix"></div>
													</dl>

													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">权限管理</dt>
														<dd class="span8">
															@foreach($perList['1'] as $k=>$v)
																<label class="chbox">
																	<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																	<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
																</label>
															@endforeach
														</dd>
														<div class="clearfix"></div>
													</dl>
												</div>
												<div class="all-btner">
													<div class="allselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo" />全选
													</div>
													<div class="revselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo"  />重置
													</div>
												</div>
											</div>

											<!-- 用户设置2 -->
											<div class="perall">
												<div  class="permission-list">
													<div class="pertit">
														<!-- <input name="user-Character-0" class="ace" type="checkbox" id="id-disable-check"> -->
														<span class="lbl">用户设置</span>
													</div>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">用户信息</dt>
														<dd class="span8">
															@foreach($perList['2'] as $k=>$v)
															<label class="chbox">
																<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
															</label>
															@endforeach
														</dd>
														<div class="clearfix"></div>
													</dl>
												</div>
												<div class="all-btner">
													<div class="allselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo" />全选
													</div>
													<div class="revselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo"  />重置
													</div>
												</div>
											</div>

											<!-- 模块管理3 -->
											<div class="perall">
												<div  class="permission-list">
													<div class="pertit">
														<!-- <input name="user-Character-0" class="ace" type="checkbox" id="id-disable-check"> -->
														<span class="lbl">模块管理</span>
													</div>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">模块展示</dt>
														<dd class="span8">
															@foreach($perList['3'] as $k=>$v)
															<label class="chbox">
																<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
															</label>
															@endforeach

														</dd>
														<div class="clearfix"></div>
													</dl>
												</div>
												<div class="all-btner">
													<div class="allselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo" />全选
													</div>
													<div class="revselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo"  />重置
													</div>
												</div>
											</div>
											<!-- 订单管理4 -->
											<div class="perall">
												<div  class="permission-list">
													<div class="pertit">
														<!-- <input name="user-Character-0" class="ace" type="checkbox" id="id-disable-check"> -->
														<span class="lbl">订单管理</span>
													</div>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">订单信息</dt>
														<dd class="span8">
															@foreach($perList['4'] as $k=>$v)
																<label class="chbox">
																	<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																	<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
																</label>
															@endforeach
														</dd>
														<div class="clearfix"></div>
													</dl>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">订单开单</dt>
														<dd class="span8">
															@foreach($perList['5'] as $k=>$v)
																<label class="chbox">
																	<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																	<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
																</label>
															@endforeach
														</dd>
														<div class="clearfix"></div>
													</dl>
												</div>
												<div class="all-btner">
													<div class="allselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo" />全选
													</div>
													<div class="revselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo"  />重置
													</div>
												</div>
											</div>

											<!-- 认证管理5 -->
											<div class="perall">
												<div  class="permission-list">
													<div class="pertit">
														<!-- <input name="user-Character-0" class="ace" type="checkbox" id="id-disable-check"> -->
														<span class="lbl">认证管理</span>
													</div>
													<dl class="permission-dl row-fluid clearfix j-rolUser">
														<dt class="span2">认证资料</dt>
														<dd class="span8">
															@foreach($perList['6'] as $k=>$v)
																<label class="chbox">
																	<img src="{{URL::asset('/static/images/c_checkbox_off.png')}}"/>
																	<input type="checkbox"data-id="{{$v->id}}" value="1" class="checkson checkbox_child checkinfo"  name="user-Character" />{{$v->title}}
																</label>
															@endforeach
														</dd>
														<div class="clearfix"></div>
													</dl>
												</div>
												<div class="all-btner">
													<div class="allselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo" />全选
													</div>
													<div class="revselect" >
														<input type="checkbox"   class="checkson checkbox_child checkinfo"  />重置
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>


								@endforeach


							</div>

						</div>

					</div>


					<!--end tab-pane-->
				</div>

			</div>

			<!--end tabbable-->           

		</div>

		<!-- END PAGE CONTENT-->

	</div>
	  </div>
	</div>
	
	<!-- footer -->
	<div class="footer">
		<div class="footer-inner"> Copyright &copy; 开单管理   沪ICP备16047540号-1</div>
		<div class="footer-tools"> <span class="go-top"> <i class="icon-angle-up"></i> </span> </div>
	</div>
    
    <!--新增用户弹窗-->
    <div class="adduser hide" id="j-addUser">  	
		<div class="row-fluid">
			<div class="span12">
				<form action="#" id="form_adduser" class="form-horizontal padding-top-20">
					{{ csrf_field() }}
					<div class="control-group">
						<label class="control-label tanwid">用户名称<span class="required">*</span></label>
						<div class="controls mlft">			
							<input type="text" id="username" value="" class="span7 m-wrap c-detailress" autocomplete="off" name="detailRess" placeholder="请输入用户名">
						</div>			
					</div>
					<div class="control-group">
						<label class="control-label tanwid">所属角色<span class="required">*</span></label>
						<div class="controls mlft">			
					        <select id="rolems" class="m-wrap" multiple="multiple" style="width: 200px; margin-left: 0px">
								@foreach($roleAll as $k=>$v)
					            <option name="{{$v->id}}" value="{{$v->id}}" >{{$v->name}}</option>
								@endforeach

							</select>

						</div>			
					</div>
					<div class="congroup">
						<label class="control-label tanwid"></label>
						<div class="tiper j-utiper"><!-- 用户名不能为空 --></div>			
					</div>

					<!-- <div class="form-actions">			
						<button type="submit" class="btn green">确定</button>		
						<button type="button" class="btn" onclick="closedHandler()">取消</button>			
					</div>	 -->

				</form>
			</div>
		</div>
    </div>    
	 <!--新增角色弹窗-->
    <div class="addrole hide" id="j-addRole">  	
		<div class="row-fluid">
			<div class="span12">
				<form action="#" id="form_addrole" class="form-horizontal padding-top-20">
					{{ csrf_field() }}
					<div class="control-group">
						<label class="control-label tanwid">角色名称<span class="required">*</span></label>
						<div class="controls mlft">			
							<input type="text" id="role_name" class="span7 m-wrap c-detailress" autocomplete="off" name="Role[name]" placeholder="请输入角色名称">
						</div>			
					</div>
					<div class="control-group">
						<label class="control-label tanwid">角色描述<span class="required">*</span></label>
						<div class="controls mlft">			
							<input type="text" id="role_description" class="span7 m-wrap c-detailress" autocomplete="off" name="Role[description]" placeholder="请输入角色描述">
						</div>			
					</div>
					<div class="congroup">
						<label class="control-label tanwid"></label>
						<div class="tiper j-utiper"><!-- 用户名不能为空 --></div>			
					</div>
										
					<!-- <div class="form-actions">			
						<button type="submit" class="btn green">确定</button>		
						<button type="button" class="btn" onclick="closedHandler()">取消</button>			
					</div>	 -->
				</form>
			</div>
		</div>
    </div>

	<script src="{{URL::asset('/static/js/bootstrap/bootstrap-datepicker.min.js')}}"></script>
	<script src="{{URL::asset('/static/js/bootstrap/bootstrap-datepicker.zh-CN.min.js')}}"></script>
	<link rel="stylesheet" href="{{URL::asset('/static/style/bootstrap/bootstrap-datepicker3.standalone.min.css')}}">
	<script type="text/javascript" src="{{URL::asset('/static/js/public/app.js')}}"></script>
	<script type="text/javascript" src="{{URL::asset('/static/js/public/layer.js')}}"></script>
	<link rel="stylesheet" type="text/css" href="{{URL::asset('/static/style/public/layer.css')}}" />
	{{--<script src="{{URL::asset('/static/js/lib/common.js')}}" type="text/javascript"></script>--}}

	<!-- 资质common js -->
	<script type="text/javascript" src="{{URL::asset('/static/js/lib/lib-quaty.js')}}"></script>
	<script type="text/javascript" src="{{URL::asset('/static/js/public/multiple-select.js')}}"></script>
	<link type="text/css" rel="stylesheet" href="{{URL::asset('/static/style/public/multiple-select.css')}}" />
	<script>

		/*
			* name:时间范围控件
			* start:起始时间表单id值
			* end:结束时间表单id值
			*
    	*/
		function dataTimeRange(start,end){//日期范围
		    $('#'+start).datetimepicker({
                minView: 2,
		        todayBtn : "linked",
		        autoclose : true,
		        todayHighlight : true,
		        endDate : new Date(),
		        format:'yyyy-mm-dd ',
		        language:'zh-CN'
		    }).on('changeDate',function(e){
		        var startTime = e.date;
		        $('#'+end).datetimepicker('setStartDate',startTime);
		    });
		 
		    //结束时间
		    $('#'+end).datetimepicker({
                minView: 2,
		        todayBtn : "linked",
		        autoclose : true,
		        todayHighlight : true,
		        endDate : new Date(),
		        format:'yyyy-mm-dd',
		        language:'zh-CN'
		    }).on('changeDate',function(e){
		        var endTime = e.date;
		        $('#'+start).datetimepicker('setEndDate',endTime);
		    });
		} 
		dataTimeRange("beginTime","endTime")		
		dataTimeRange("loginLatyTime","loginOverTime");
        dataTimeRange("role_beginTime","role_endTime");

		//select多选
		 $(function() {
             $('#rolems').change(function() {
                 // console.log($(this).val());

             }).multipleSelect({

             });
	    });
	</script>	
</body>

</html>